<?php 

require_once('accesscheck.php'); 
$query_rsBanner = "SELECT banner_images.id, banner_images.BannerName, banner_images.BannerDesc, banner_images.BannerPath, banner_images.BannerType, banner_images.Width, banner_images.Height, banner_types.TypeName FROM banner_images , banner_types WHERE banner_types.TypeExtension =  banner_images.BannerType ORDER BY rand() ASC LIMIT 1";

$colname_rsBanner = "-1";
if (isset($_GET['bid'])) {
  $colname_rsBanner = $_GET['bid'];
  $query_rsBanner = sprintf("SELECT * FROM banner_images WHERE id = %s", GetSQLValueString($colname_rsBanner, "int"));
}

$rsBanner = mysql_query($query_rsBanner, $config) or die(mysql_error());
$row_rsBanner = mysql_fetch_assoc($rsBanner);
$totalRows_rsBanner = mysql_num_rows($rsBanner);

//$offsetPath = $row_rsBanner['BannerPath'];
$scriptPath = substr($row_rsBanner['BannerPath'], 0, strpos($row_rsBanner['BannerPath'], ".",5));
?>
<script src="../scripts/AC_RunActiveContent.js" type="text/javascript"></script>

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin:0px;">
  <?php if( $row_rsBanner['BannerType'] == "swf" ) { ?>
  <tr>
    <td align="center">
      <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','<?php echo $row_rsBanner['Width']; ?>','height','<?php echo $row_rsBanner['Height']; ?>','src','<?php echo $row_rsBanner['BannerPath']; ?>','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','<?php echo $scriptPath; ?>' ); //end AC code
    </script>
      <noscript>
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="<?php echo $row_rsBanner['Width']; ?>" height="<?php echo $row_rsBanner['Height']; ?>">
          <param name="movie" value="<?php echo $row_rsBanner['BannerPath']; ?>">
          <param name="quality" value="high">
          <param name="wmode" value="transparent">
          <embed src="<?php echo $row_rsBanner['BannerPath']; ?>" width="<?php echo $row_rsBanner['Width']; ?>" height="<?php echo $row_rsBanner['Height']; ?>" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed>
        </object>
      </noscript>
    </td>
  </tr>
  <?php } else { ?>
  <tr>
    <td align="center"><img src="<?php echo $row_rsBanner['BannerPath']; ?>" alt="" name="banner" id="banner" width="<?php echo $row_rsBanner['Width']; ?>" 
    height="<?php echo $row_rsBanner['Height']; ?>"/></td>
  </tr>
  <?php } ?>
</table>
<?php
mysql_free_result($rsBanner);
?>
